package com.lmm.rpc.core.client;

import io.netty.channel.Channel;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;

/**
 * netty客户端工厂
 *
 * 单列双重检测
 * */
@ConditionalOnClass({Channel.class})
public class NettyClientFactory {
    private  static NettyClient instance;
    private NettyClientFactory(){}

    public static NettyClient getInstance() {
        if (instance == null){
            synchronized (NettyClientFactory.class){
                if (instance == null)
                    instance = new NettyClient();
            }
        }
        return instance;
    }
}
